import 'package:flutter/material.dart';
import '../controller/list.dart';

class TodoSection extends StatelessWidget {
  const TodoSection(this.todo, {Key? key}) : super(key: key);

  final Todo todo;

  @override
  Widget build(context) {
    // Instantiate your class using Get.put() to make it available for all "child" routes there.

    print(todo.title + "会不会也构造一遍");
    return Row(children: [
      Image.network(todo.avatar, width: 100, height: 100),
      Container(
        margin: const EdgeInsets.only(left: 20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            SelectableText(todo.title),
            Text(
              todo.description,
            ),
            Useless(todo.title + "无状态")
          ],
        ),
      )
    ]);
  }
}

class Useless extends StatelessWidget {
  String text = "就是一个无状态组件";

  Useless(
    this.text, {
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    print(text);
    return Text(text);
  }
}
